// pages/personnel/user/setting-edit/wxh/wxh.js
import {isInputEmpty} from "../../../../utils/Util"
import Behavior from "../behavior";
Component({
    /*
    * 组件间代码共享
    * */
    behaviors: [Behavior],

    /**
     * 组件的属性列表
     */
    properties: {
        value: {
            type: String,
            value: ""
        },
        loading: {
            type: Boolean,
            value: false
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        _wx: "",
        _wxErrorMsg: ""
    },

    /**
     * 组件的方法列表
     */
    methods: {

        /*
        * 点击保存按钮
        * */
        onSaveButton: function () {
            let wx = this.data._wx;
            let isLoading = this.data.loading;
            if (isLoading) { //防重复
                return false
            } else if (!isInputEmpty(wx)) {
                this.setData({_wxErrorMsg: "微信号不能为空"})
                return false
            } else {
                this.triggerEvent("save", {wx: wx});
            }
        }
    }
})
